package com.lebang.model.enums;

/**
 * 推送类型
 * @className PushMsgEnum
 * @author hwq
 * @date
 */
public enum PushMsgEnum {

	/**
	 *  推送类型
	 */
	HONG_BAO("新手红包", 1),
	TASK("任务", 2);

	private String title;
	private int index;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	private PushMsgEnum(String title, int index) {
		this.title = title;
		this.index = index;
	}
	
	public PushMsgEnum getByIndex(int index) {
		for (PushMsgEnum e : PushMsgEnum.values()) {
			if (e.index == index) {
				return e;
			}
		}
		return null;
	}
	
	public PushMsgEnum getByTitle(String title) {
		if (null == title) {
			return null;
		}
		for (PushMsgEnum e : PushMsgEnum.values()) {
			if (e.title.equals(title)) {
				return e;
			}
		}
		return null;
	}
}
